From 7070659a99c216afd1e9a64cc3de24b8967c76a5 Mon Sep 17 00:00:00 2001 From: tsteven4 Date: Wed, 13 Mar 2019 11:13:07 -0600 Subject: [PATCH] fix stackfilter issues. (#324) 1. correct defect in the new RouteList::swap method. 2. correct an old bug in stackfilter that cleaned up waypts on exit, but not routes or tracks. 3. enhance stackfilter test to test routes and tracks as well as waypts. --- route.cc | 4 ++-- stackfilter.cc | 2 ++ testo.d/stackfilter.test | 4 ++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/route.cc b/route.cc index c3b5742ab..81b7ff398 100644 --- a/route.cc +++ b/route.cc @@ -521,8 +521,8 @@ RouteList::restore(RouteList* src) void RouteList::swap(RouteList& other) { const RouteList tmp_list = *this; - other = *this; - *this = tmp_list; + *this = other; + other = tmp_list; } void RouteList::sort(Compare cmp) diff --git a/stackfilter.cc b/stackfilter.cc index c50f5445d..3721ab25a 100644 --- a/stackfilter.cc +++ b/stackfilter.cc @@ -166,6 +166,8 @@ void StackFilter::exit() } while (stack) { waypt_flush(&(stack->waypts)); + stack->routes.flush(); + stack->tracks.flush(); tmp_elt = stack; stack = stack->next; delete tmp_elt; diff --git a/testo.d/stackfilter.test b/testo.d/stackfilter.test index bc25122c9..25ab1b89b 100644 --- a/testo.d/stackfilter.test +++ b/testo.d/stackfilter.test @@ -7,3 +7,7 @@ gpsbabel -i geo -f ${REFERENCE}/../geocaching.loc -x stack,push,copy,nowarn -x stack,push,copy -x stack,push -x stack,pop,replace -x stack,pop,append -x stack,push,copy -x stack,pop,discard -x stack,swap,depth=1 -o arc -F ${TMPDIR}/stackfilt.txt +gpsbabel -i geo -f ${REFERENCE}/../geocaching.loc -x transform,rte=wpt,del -x stack,push,copy,nowarn -x stack,push,copy -x stack,push -x stack,pop,replace -x stack,pop,append -x stack,push,copy -x stack,pop,discard -x stack,swap,depth=1 -o arc -F ${TMPDIR}/stackfilt.txt + +gpsbabel -i geo -f ${REFERENCE}/../geocaching.loc -x transform,trk=wpt,del -x stack,push,copy,nowarn -x stack,push,copy -x stack,push -x stack,pop,replace -x stack,pop,append -x stack,push,copy -x stack,pop,discard -x stack,swap,depth=1 -o arc -F ${TMPDIR}/stackfilt.txt + -- 2.30.2